
$(document).ready(function() {

    App.init();
    TableManageFixedHeader.init();
    //日期控件
    $("#datetimepicker").datepicker({
        autoclose: true, //自动关闭
        beforeShowDay: $.noop,    //在显示日期之前调用的函数
        calendarWeeks: false,     //是否显示今年是第几周
        clearBtn: false,          //显示清除按钮
        daysOfWeekDisabled: [],   //星期几不可选
        endDate: Infinity,        //日历结束日期
        forceParse: true,         //是否强制转换不符合格式的字符串
        format: 'yyyy-mm-dd',     //日期格式
        keyboardNavigation: true, //是否显示箭头导航
        language: "zh-CN",           //语言
        minViewMode: 0,
        orientation: "auto",      //方向
        rtl: false,
        startDate: -Infinity,     //日历开始日期
        startView: 0,             //开始显示
        todayBtn: false,          //今天按钮
        todayHighlight: true,    //今天高亮
        weekStart: 0
    });

});

function openModel1(type) {
    var status = $("#myForm7").submit().parsley();
    if (status.isValid()) {
        if (type == 1) {
            $("#typee").val(1);
            $("#me").html("确认审核通过？");
        } else if (type == 2) {
            $("#typee").val(2);
            $("#me").html("确认审核驳回？");
        }
        $('#modal-dialog').modal({backdrop: 'static', keyboard: false});
    }
}
//打开模态框
function openModel(ids, type) {
    $("#tid").val(ids);
    $("#typee").val(type);
    if (type == 1) {
        $("#me").html("确认审核通过？");
    } else if (type == 2) {
        $("#me").html("确认审核驳回？");
    }
    $('#modal-dialog').modal({backdrop: 'static', keyboard: false});
}

function doSomeThing() {
    var tid = $("#tid").val();
    var type = $("#typee").val();
    if (type == 1) {
        Sure();
    } else if (type == 2) {
        NoSure();
    }
    $('#modal-dialog').modal('hide')
}

function Sure() {
    var role = $("#role").val();
    var url = null;
    var url2 = null;
    if (role == '0') {
        url = "/advance/checkAdvanceByBusiness";
        url2 = "/task/tolist";
    } else if (role == '1') {
        url = "/advance/checkAdvanceByFinance";
        url2 = "/task/tolist";
    }
    $.ajax({
        url: url,
        type: "POST",
        data: $('#myForm7').serialize(),
        success: function (data) {
            if (data) {
                window.location.href = url2;
            }
        }
    });
}

function NoSure() {
    $.ajax({
        url: "/advance/rejectAdvance",
        type: "POST",
        data: $('#myForm7').serialize(),
        success: function (data) {
            if (data) {
                window.location.href = "/task/tolist";
            }
        }
    });
}


